package icu.makka.yygh.controller;

import icu.makka.yygh.result.Result;
import icu.makka.yygh.service.DepartmentService;
import icu.makka.yygh.service.impl.DepartmentServiceImpl;
import icu.makka.yygh.vo.hosp.DepartmentVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "科室后台管理")
@Slf4j
@RestController
@RequestMapping("/admin/hosp/department")
public class DepartmentController {

    @Autowired
    private DepartmentServiceImpl departmentService;

    /**
     * 查询医院所有科室列表
     * @param hoscode
     * @return
     */
    @ApiOperation(value = "查询医院所有科室列表")
    @GetMapping("getDepList/{hoscode}")
    public Result getDepList(@PathVariable("hoscode") String hoscode) {
        log.info("查询医院所有科室列表");
        List<DepartmentVo> list = departmentService.findDeptTree(hoscode);
        return Result.ok(list);
    }
}
